package com.coderfans.serialize;

import com.coderfans.exception.SerializeException;

/**
 * Created by ${fanchunshuai} on 2016-9-22.
 *
 * @version: V1.0
 * @Desc:
 * @Copyright (c) 2016 58到家-版权所有
 */
public class StringSerialize implements ISerialize<String> {

    @Override
    public byte[] serialize(String s) throws SerializeException {
        try {
            return s.toString().getBytes();
        }catch (Exception e){
            throw new SerializeException(e.getMessage());
        }
    }

    @Override
    public String disSerialize(Class<String> clazz, byte[] objectByte) throws SerializeException {
        return new String(objectByte);
    }
}
